package com.leizhou.consumer;

import feign.Logger;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * @author LT
 * @version 1.0.0
 * @ClassName ConsumerApplication.java
 * @Description TODO 消费者启动类
 * @createTime 2020年04月24日 16:07:00
 */

// @SpringBootApplication
// @EnableDiscoveryClient // 启动eureka客户端(发现者)
// @EnableCircuitBreaker  // 开启熔断器
@SpringCloudApplication
@EnableFeignClients  // 开启Feign客户端
public class ConsumerApplication {

    public static void main(String[] args) {
        // 运行spring应用
        SpringApplication.run(ConsumerApplication.class, args);
    }

    @Bean
    @LoadBalanced // 负载均衡注解
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

    // Feign日志级别
    @Bean
    public Logger.Level feignLoggerLevel(){
        return Logger.Level.FULL;
    }
}
